package cc.magicjson.mall.order.application.command;



import cc.magicjson.mall.common.domain.ProductId;
import cc.magicjson.mall.order.domain.model.CustomerId;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor(force = true)
public class CreateOrderCommand {
    private final CustomerId customerId;
    private final List<OrderItem> items;

    public CreateOrderCommand(CustomerId customerId, List<OrderItem> items) {
        this.customerId = customerId;
        this.items = items;
    }

    public CustomerId getCustomerId() {
        return customerId;
    }

    public List<OrderItem> getItems() {
        return items;
    }

    @NoArgsConstructor(force = true)
    public static class OrderItem {
        private final ProductId productId;
        private final int quantity;

        public OrderItem(ProductId productId, int quantity) {
            this.productId = productId;
            this.quantity = quantity;
        }

        public ProductId getProductId() {
            return productId;
        }

        public int getQuantity() {
            return quantity;
        }
    }
}